<template>
    <div class="demo">
        <h2>学生名称：{{ name }}</h2>
        <h2>学生地址：{{ age}}</h2>
        <button @click="sendstudent">点我得到学生名字</button>
    </div> 
</template>
<script>
    export default{
        name:'MyStudent',
        props:['getstudent'],
        data(){
            return {
                name:'张三',
                age:19
            }
        },
        methods:{
            sendstudent(){
                this.getstudent(this.name)
            }
        }
    }
</script>
<style>
    .demo{
        background-color: yellow;
    }
</style>